package com.huawei.appgallery.wishlist.control;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
import com.huawei.appgallery.wishlist.bean.WishDeleteInfo;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.ArrayList;
import java.util.List;
import o.azb;
import o.dce.e;
import o.dce.i;
import o.dce.j;
import o.ContentManager;
import o.epu;
import o.CollectCheck;

public class WishDeleteListAdapter extends BaseAdapter {
    private LayoutInflater mInflater;
    private List<WishDeleteInfo> wishList = null;

    static class c {
        private CheckBox ˊ;
        private TextView ˎ;
        private TextView ˏ;

        private c() {
        }

        public CheckBox ˋ() {
            return this.ˊ;
        }

        public void ˊ(CheckBox checkBox) {
            this.ˊ = checkBox;
        }

        public TextView ˊ() {
            return this.ˏ;
        }

        public void ˊ(TextView textView) {
            this.ˏ = textView;
        }

        public TextView ˏ() {
            return this.ˎ;
        }

        public void ॱ(TextView textView) {
            this.ˎ = textView;
        }
    }

    public WishDeleteListAdapter(Activity activity, List<WishDeleteInfo> list) {
        if (list == null) {
            list = new ArrayList();
        }
        this.wishList = list;
        this.mInflater = LayoutInflater.from(activity);
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        WishDeleteInfo itemWishInfo = getItemWishInfo(i);
        if (itemWishInfo != null) {
            view = initItemWishInfoView(itemWishInfo, this.mInflater);
            if (this.wishList != null && this.wishList.size() - 1 == i) {
                view.findViewById(e.ˋʻ).setVisibility(4);
            }
        }
        return view;
    }

    private View initItemWishInfoView(WishDeleteInfo wishDeleteInfo, LayoutInflater layoutInflater) {
        if (wishDeleteInfo == null) {
            return null;
        }
        View inflate = layoutInflater.inflate(i.ʻॱ, null);
        c initWishInfoHolder = initWishInfoHolder(inflate);
        initWishInfoHolder.ˊ().setText(wishDeleteInfo.ˊ());
        String string = ContentManager.getInstant().getContext().getString(j.ˏॱ);
        String ˏ = epu.ˏ("yyyy/MM/dd", Long.valueOf(Long.parseLong(wishDeleteInfo.ˎ())));
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(string).append(HwAccountConstants.BLANK).append(ˏ);
        initWishInfoHolder.ˏ().setText(stringBuilder.toString());
        initWishInfoHolder.ˋ().setChecked(wishDeleteInfo.ᐝ());
        return inflate;
    }

    private c initWishInfoHolder(View view) {
        c cVar = new c();
        TextView textView = (TextView) view.findViewById(e.ˋʽ);
        TextView textView2 = (TextView) view.findViewById(e.ˊʽ);
        CheckBox checkBox = (CheckBox) view.findViewById(e.ॱˊ);
        azb.ʻ((View) checkBox);
        azb.ˎ(view, e.ˌॱ);
        azb.ˎ(view, e.ˋʻ);
        azb.ˋ(view, e.ˋʻ);
        cVar.ˊ(textView);
        cVar.ॱ(textView2);
        cVar.ˊ(checkBox);
        return cVar;
    }

    public Object getItem(int i) {
        return this.wishList.get(i);
    }

    public long getItemId(int i) {
        return (long) i;
    }

    private WishDeleteInfo getItemWishInfo(int i) {
        if (CollectCheck.isEmpty(this.wishList) || i >= this.wishList.size()) {
            return null;
        }
        return (WishDeleteInfo) this.wishList.get(i);
    }

    public int getCount() {
        return this.wishList.size();
    }
}
